package com.ruoyi.common.utils.excel;

import java.io.IOException;
import java.util.List;

/**
 * 查询特定人员在特定日期的工作
 */
public class ExampleUsage {
    public static void main(String[] args) throws IOException {
        String filePath = "表格数据.xlsx";
        List<PersonData> personDataList = ExcelPersonDataReader.readExcelData(filePath);

        // 查询孙鸿历在2025-10-09的工作
        String work = ExcelPersonDataReader.getWorkByDate(
                personDataList, "孙鸿历", "2025-10-09 00:00:00");
        System.out.println("孙鸿历在2025-10-09的工作: " + work);

        // 查询肖奕超在2025-10-10的工作
        String work2 = ExcelPersonDataReader.getWorkByDate(
                personDataList, "肖奕超", "2025-10-10 00:00:00");
        System.out.println("肖奕超在2025-10-10的工作: " + work2);

        // 获取张衡的完整数据
        PersonData zhangHeng = ExcelPersonDataReader.getPersonDataByName(personDataList, "张衡");
        if (zhangHeng != null) {
            System.out.println("张衡的当前业务: " + zhangHeng.getCurrentBusiness());
            System.out.println("10月份工作安排:");
            zhangHeng.getDateData().forEach((date, workContent) -> {
                if (workContent != null && !workContent.isEmpty()) {
                    System.out.println("  " + date + ": " + workContent);
                }
            });
        }
    }
}
